package fpTree;

public class ExtNode extends Node
{
	boolean frequent = false;
	int childrenCount = 0;
	private ExtNode nodeLink;
	public ExtNode parent;
	
	@Override
	public String toString()
	{
		return new StringBuilder().append(this.itemName).append("-").append(this.getCount()).append("-")
				.append(this.childrenCount).append("-").append(this.frequent).append("-")
				.append("-").append(this.hashCode()).toString();
	}
	
	public String printTree()
	{
		StringBuffer sb = new StringBuffer();
		printTree(">> ", sb);
		return sb.toString();
	}
	
	public String printTree(String spacing)
	{
		StringBuffer sb = new StringBuffer();
		printTree(spacing + ">> ", sb);
		return sb.toString();
	}
	
	public void printTree(String spacing, StringBuffer sb)
	{
		sb.append(spacing).append(this).append("\n");
		for (Node child : this.getChildren().values())
		{
			((ExtNode) child).printTree(spacing + "    ", sb);
		}
	}
	
	public ExtNode getNodeLink()
	{
		return this.nodeLink;
	}

	public void setNodeLink(ExtNode nodeLink)
	{
		this.nodeLink = nodeLink;
	}
	
}
